home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number6 / input2.cpp < prev    next >
Text File  |  1990-12-11  |  326b  |  13 lines

  1. // Listing 4: INPUT2.CPP.
  2. // inline assembly input() referencing C++ names
  3.  
  4. void statistician::input(int i)
  5. {
  6.   asm {
  7.     mov si, word ptr this     // Point to object data with si
  8.     mov ax, word ptr i        // Load AX with i
  9.     add word ptr [si].sum, ax // sum += i
  10.     inc word ptr [si].n       // n++
  11.   }
  12. }
  13.